﻿#include "videoitem.h"
#include "ui_videoitem.h"

#include <QUrl>

VideoItem::VideoItem(const QUrl & url, QWidget *parent)
    : QWidget(parent), ui(new Ui::VideoItem), url_(url)
{
    ui->setupUi(this);
    ui->label_filename->setText(url.fileName());
    ui->progressBar->setValue(0);
    ui->btn_play->hide();

    connect(ui->btn_play, &QPushButton::clicked, this, [this](){emit btn_clicked();});
}

void VideoItem::set_state(const QString &state)
{
    ui->label_state->setText(state);
}

QString VideoItem::get_state()
{
    return ui->label_state->text();
}

void VideoItem::show_btn()
{
    ui->btn_play->show();
}

void VideoItem::set_progress(int value)
{
    ui->progressBar->setValue(value);
}

VideoItem::~VideoItem()
{
    delete ui;
}
